package com.vf.admin.client.service.impl;

import com.vf.admin.client.dao.AppMingxiDuihuanDao;
import com.vf.admin.client.service.AppMingxiDuihuanService;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.AppMingxiDuihuan;
import com.vf.admin.miaodong.entity.AppUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Service
public class AppMingxiDuihuanServiceImpl implements AppMingxiDuihuanService {
    @Autowired
    private AppMingxiDuihuanDao appMingxiDuihuanDao;

    @Override
    public List<AppMingxiDuihuan> findList(Integer userid, SplitPageBean splitPage) {
        return appMingxiDuihuanDao.findList(userid, splitPage);
    }

    @Override
    public AppMingxiDuihuan get(Integer id) {
        return appMingxiDuihuanDao.get(id);
    }

    @Override
    public void save(AppMingxiDuihuan haoYou) {
        appMingxiDuihuanDao.save(haoYou);
    }

    @Override
    public void addMingxi(AppUser user, BigDecimal zuanshi, Integer meilizhi, String beizhu) {
        AppMingxiDuihuan duihuan=new AppMingxiDuihuan();
        duihuan.setCreatetime(new Date());
        duihuan.setUserid(user.getId());
        duihuan.setPic(user.getPic());
        duihuan.setNick(user.getNick());
        duihuan.setPhone(user.getLoginname());
        duihuan.setZuanshinum(zuanshi.intValue());
        duihuan.setMielizhinum(meilizhi);
        duihuan.setBeizhu(beizhu);
        appMingxiDuihuanDao.save(duihuan);
    }


}
